Skip to content

Documentation for self-hosting with docker compose #855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

unteem
Copy link

@unteem unteem commented Apr 7, 2025

Purpose

Make self hosting of Docs easier with an example of a deployment procedure with docker compose and document how to configure Docs.

While #583 propose an easy way to deploy Docs with docker and Make, here we describe more in details the various steps and requirements to deploy Docs.

Proposal

  • example to deploy and configure keycloak
  • example to deploy and configure minio
  • example to configure proxy and certs
  • example to deploy and configure Docs

Improvements

  • Rephrase description of environment variables and categorize
  • Use template for nginx conf

Fixes #561
Supersedes #583

A one liner quick start could be a nice addition:

  • merge all services in a single compose
  • scripts to generate secrets

@unteem unteem force-pushed the documentation-docker branch 2 times, most recently from 48a9bc4 to ae27df7 Compare April 8, 2025 06:37
@unteem unteem force-pushed the documentation-docker branch from ae27df7 to 3531bf4 Compare April 8, 2025 08:50
@AntoLC AntoLC requested a review from lunika April 8, 2025 19:23
docker compose pull
```

### Step 3: Restart yout containers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yout

Comment on lines +67 to +79
location /collaboration-auth {
proxy_pass http://docs_backend/api/v1.0/documents/collaboration-auth/;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Original-URL $request_uri;

# Prevent the body from being passed
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-Method $request_method;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need this anymore as mentioned here. I am not sure if we still need /media-auth or not. I've managed to spin up docs with traefik without these two /collaboration-auth and /media-auth with socket connection and real time collaboration.

Copy link
Member

@lunika lunika left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you commits does not have a description. It is useful to add it to explain why you made the modification about the env.md file for example.

Comment on lines +48 to +79
location /collaboration/ws/ {
# Ensure WebSocket upgrade
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";

# Collaboration server
proxy_pass http://y-provider:4444;

# Set appropriate timeout for WebSocket
proxy_read_timeout 86400;
proxy_send_timeout 86400;

# Preserve original host and additional headers
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Origin $http_origin;
proxy_set_header Host $host;
}

location /collaboration-auth {
proxy_pass http://docs_backend/api/v1.0/documents/collaboration-auth/;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Original-URL $request_uri;

# Prevent the body from being passed
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-Method $request_method;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this part, it has been removed in the main branch, it is not used anymore.

curl -o compose.yaml https://raw.githubusercontent.com/suitenumerique/docs/refs/heads/main/docs/examples/compose/nginx-proxy/compose.yaml
```

### Step 2: Edit `DEFAULT_EMAIL` in the compose file.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no description for this step 2.


### Step 2: Edit `DEFAULT_EMAIL` in the compose file.

### Create docker network
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing step 3

docker compose pull
```

### Step 3: Restart yout containers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before restarting the containers you should suggest to read the UPGRADE.md file.

DOCS_HOST=docs.domain.tld
KEYCLOAK_HOST=id.domain.tld
S3_HOST=storage.domain.tld
MINIO_HOST=storage.domain.tld
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is MINIO_HOST used?

POSTGRES_PASSWORD=<generate postgres password>
PGDATA=/var/lib/postgresql/data/pgdata

# Keyclaok postgresql configuration
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keyclaok


```bash
mkdir -p docs/env.d
curl -o compose.yaml https://raw.githubusercontent.com/suitenumerique/docs/refs/heads/main/docs/examples/compose.yaml
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you put the compose.yaml in a different directory than docs/examples/compose.yaml

curl -o compose.yaml https://raw.githubusercontent.com/suitenumerique/docs/refs/heads/main/docs/examples/compose.yaml
curl -o env.d/common https://raw.githubusercontent.com/suitenumerique/docs/refs/heads/main/docs/env.d/production.dist/common
curl -o env.d/backend https://raw.githubusercontent.com/suitenumerique/docs/refs/heads/main/docs/env.d/production.dist/backend
curl -o env.d/yprovider https://raw.githubusercontent.com/suitenumerique/docs/refs/heads/main/docs/env.d/production.dist/yprovider
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing env.d/postgresql?

1. Navigate to the "Clients" tab.
2. Click on the "Create client" button.
3. Enter the client ID - e.g. `docs`.
4. Enable "Client authentification" option.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Client authentication

env_file:
- env.d/backend
- env.d/postgresql
- env.d/common
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe common needs to come before backend, otherwise you get errors like this

WARN[0000] The "DOCS_HOST" variable is not set. Defaulting to a blank string. 
WARN[0000] The "DOCS_HOST" variable is not set. Defaulting to a blank string. 
WARN[0000] The "S3_HOST" variable is not set. Defaulting to a blank string. 


```bash
docker compose run --rm app python manage.py migrate
docker compose run --rm app python manage.py createsuperuser --email <admin email> --password <admin password>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"app" should be "backend"? also at the bottom of this file


Replace `<admin email>` with the email of your admin user and generate a secure password.

Your docs instance is now avalailable on the domain you defined, https://docs.yourdomain.tld.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avalailable

# - VIRTUAL_PORT=8083 # used by nginx proxy
# - LETSENCRYPT_HOST=${DOCS_HOST} # used by lets encrypt to generate TLS certificate
volumes:
- ./default.conf.template:/etc/nginx/templates/default.conf.template
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think /docker-entrypoint.d/20-envsubst-on-templates.sh is never run so the template never becomes a proper config.

The upstream nginx container uses ENTRYPOINT ["/docker-entrypoint.sh"] which should call this but this is overwritten in the lasuite/impress-frontend image to /usr/local/bin/entrypoint

Am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add docker compose up production configuration
5 participants